//
//  BaseViewController.m
//  BaseProject
//
//  Created by 刘航宇 on 16/9/6.
//  Copyright © 2016年 Tarena. All rights reserved.
//

#import "BaseViewController.h"

@interface BaseViewController ()
@property (nonatomic, strong) UIImageView * bgImageView;// 背景图

@end
@implementation BaseViewController

#pragma mark --------生命周期
- (instancetype)init
{
    if (self = [super init]) {
        [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(changeTheme:) name:(NSString*)themeChangeNoti object:nil];
    }
    return self;
}
- (void)viewDidLoad
{
    [super viewDidLoad];
    // 让导航栏不遮挡底部视图
    if( ([[[UIDevice currentDevice] systemVersion] doubleValue]>=7.0)) {
        self.edgesForExtendedLayout = UIRectEdgeNone;
    }

    [self.view addSubview:self.bgImageView];
    [self.bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self.view);
    }];
    
}

- (void)changeTheme:(NSNotification*)noti
{
    // 更换主题
}
#pragma mark -------懒加载
- (UIImageView *)bgImageView {
	if(_bgImageView == nil) {
		_bgImageView = [[UIImageView alloc] init];
	}
	return _bgImageView;
}
// 移除观察
- (void)dealloc
{
    [[NSNotificationCenter defaultCenter]removeObserver:self name:(NSString*)themeChangeNoti object:nil];
}
@end
